home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SPACE 1
/
SPACE - Library 1 - Volume 1.iso
/
program
/
385
/
prg_1
/
prg_1ep.s
< prev
next >
Wrap
Text File
|
1985-11-19
|
3KB
|
62 lines
; Program Name: PRG_1EP.S
; Version: 1.002
; Assembly Instructions:
; Assemble in AssemPro PC-relative mode and save the assembled program
; program with PRG and TOS extensions.
; Program Function:
; Illustrates a method of program organization which places declarations
; at the beginning of a program.
; Note - We have not defined a program stack. We are using the default
; system stack located at $4DB8, according to Internals p. 276.
bra.s print_string ; Jump over the declarations below.
string: dc.b 'This string will not overwrite the AssemPro debugger screen.'
dc.b $D,$A,0 ; The string is continued on this line. Here, we
; declare a carriage return and linefeed, then
; terminate the entire string with a NULL = 0.
newline: dc.b $D,$A,0 ; All strings must be NULL terminated because the
; function we are used to print them requires it.
align ; This is the assembler pseudo-op that forces the next
; instruction to start at a word boundary. It is necessary
; because we have declared byte data above and we don't care to
; count the bytes to confirm that there is an even number of
; byte-size data.
text ; This is an assembler pseudo-op. dc.b is a pseudo-op also. We
; can define the string above the source code if we put this
; pseudo-op between the declaration and the text of the source.
; Of course, since the processor will attempt to execute the
; first thing it sees, whether it be an instruction or data, we
; must jump over the data. You don't jump when the data is
; actually an instruction you want to execute, such as when an
; a-line (illegal) instruction is declared as data.
print_string:
pea newline ; Prints a carriage return and linefeed.
move.w #9, -(sp) ; Function = c_conws = GEMDOS $9.
trap #1
addq.l #6, sp
pea string ; Push address of the string onto stack.
move.w #9, -(sp) ; Function = c_conws = GEMDOS $9.
trap #1 ; GEMDOS call
addq.l #6, sp ; Reset stack pointer to top of stack.
wait_for_keypress:
move.w #8, -(sp) ; Function = c_necin = GEMDOS $8.
trap #1 ; GEMDOS call.
addq.l #2, sp ; Reposition stack pointer at top of stack.
terminate: ; My descriptive label.
move.w #0, -(sp) ; Function = p_term_old = GEMDOS $0.
trap #1 ; GEMDOS call.
end ; Assembler pseudo-op.